from appium_practice.PO_MODE.page.basepage import CommonBasePage


class EditMembersPage(CommonBasePage):

    def goto_add_members_page(self):
        from appium_practice.PO_MODE.page.addmemberspage import AddMembersPage
        return AddMembersPage(self.appium_driver)

    def edit_member(self, name, phone):
        # 实现添加联系人功能 PO 封装
        self.find_app_element_and_input(('XPATH',"//android.widget.TextView[@text='姓名　']/following-sibling::android.widget"
                                       ".EditText"), name)
        self.wait(2)
        # 输入手机号
        self.find_app_element_and_input(('XPATH', "//android.widget.TextView[@text='手机　']/following-sibling::android.widget.RelativeLayout"
                                                  "/android.widget.RelativeLayout[2]/android.widget.EditText"), phone)
        self.wait(2)
        self.swipe_down()
        # 点击保存
        self.find_app_element_and_click(('XPATH', "//android.widget.TextView[@text='保存']"))
        self.wait()
        from appium_practice.PO_MODE.page.addmemberspage import AddMembersPage
        return AddMembersPage(self.appium_driver)

